/*
  路由器模块
 */

import Vue from 'vue'
import VueRouter from "vue-router";

import Home from '../views/Home'
import About from '../views/About'

import News from "../views/News";
import Message from "../views/Message";

import MessageDetail from "../views/MessageDetail";

Vue.use(VueRouter)

export default new VueRouter({
  routes: [
    {
      path: '/home',
      component: Home,
      children: [
        {
          path: '/home/news',  // path最左侧的 / 永远代表根路径
          component: News
        },
        {
          path: 'message', // 简化写法
          component: Message,
          children: [
            {
              path: 'detail/:id',
              component: MessageDetail
            }
          ]
        },
        {
          path: '',
          redirect: 'news'
        }
      ]

    },
    {
      path: '/about',
      component: About
    },
    {
      path: '/',
      redirect: '/about'
    }
  ]
})
